package com.tywj.buscustomerapp.view.activity;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.tywj.buscustomerapp.Config;
import com.tywj.buscustomerapp.R;

import butterknife.BindView;

public class ImageActivity extends BaseActivity {
    @BindView(R.id.image)
    ImageView img;
    @BindView(R.id.head_title)
    TextView title;
    @BindView(R.id.head_left)
    ImageView back;

    private String imgurl = "";
    private String url = "";
    @Override
    protected int getContentId() {
        return R.layout.activity_image;
    }

    @Override
    protected void initWidget(Bundle savedInstanceState) {
        super.initWidget(savedInstanceState);
        title.setText("活动详情");
        if (getIntent()!=null){
            imgurl = getIntent().getStringExtra("imgurl");
            url = getIntent().getStringExtra("url");
            if (imgurl!=null && !imgurl.equals("")){
                Glide.with(this.img.getContext())
                        .load(imgurl)
                        .into(img);
            }
        }
    }

    @Override
    protected void initData() {
        super.initData();
    }

    @Override
    protected void initClick() {
        super.initClick();
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        img.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (url!=null && !url.equals("")){
                    Intent intent = new Intent(v.getContext(),WebActivity.class);
                    intent.putExtra("url",url);
                    v.getContext().startActivity(intent);
                }
            }
        });
    }
}
